<template>
	<view class="pagesEntrance">
		<!-- 诊断医生工作站 管理员、平台账号 -->
		<view class="pagesEntrance_containers">
			<view class="pagesEntrance_containers_top sticky">
				<!-- fontWeight: 'bold', -->
				<u-tabs @change="changePageEntranceEvent" :current='currentIndex' :list="permissionList" lineWidth="30"
					lineHeight="3" lineColor="#ffffff" :activeStyle="{
						color: '#ffffff',
						fontWeight: 'bold',
						fontSize:'32rpx'
					}" :inactiveStyle="{
						color: '#ffffff',
						fontSize:'28rpx'
					}" itemStyle="height:90rpx; font-size:28rpx;padding:0 20rpx;text-align:center;"></u-tabs>
			</view>
			<!--  :style="{height:contentheightData}" -->
			<view class="pagesEntrance_containers_content pagesPadding" :style="{minHeight:contentheightData}">
				<!-- 整理调度 -->
				<doctorOrganize ref="doctorOrganize" v-if='currentCode=="consultation-dispatch"'></doctorOrganize>
				<!-- 院外会诊 -->
				<doctorHome ref="doctorHome" v-if='currentCode=="consultation-diagnosis"'></doctorHome>
				<!-- 加做医嘱 -->
				<doctorPlusAdd ref="doctorPlusAdd"  currentCode="extraProject"  v-if='currentCode=="extraProject"'></doctorPlusAdd>
				<!-- 会诊申请 -->
				<doctorApply ref="askList" currentCode="askList" v-if='currentCode=="askList"'></doctorApply>
				<!-- 快递管理 -->
				<doctorExpress ref="doctorExpress" currentCode="expressList" v-if='currentCode=="expressList"'></doctorExpress>
				<!-- 项目检测 -->
				<doctorDetection ref="doctorDetection" currentCode="detectionList" v-if='currentCode=="detectionList"'></doctorDetection>
				<!-- 代转资料 -->
				<doctorTransfer ref="doctorTransfer" currentCode="transferInfo" v-if='currentCode=="transferInfo"'></doctorTransfer>
				<!-- 我的沟通 -->
				<doctorConsultation ref="doctorConsultation" currentCode="interact" v-if='currentCode=="interact"' :type='1'></doctorConsultation>
				
			</view>

		</view>

	</view>
</template>

<script>
	import doctorApply from '@/components/doctorApply/doctorApply.vue' //会诊申请
	import doctorHome from '@/components/doctorHome/doctorHome.vue' //院外会诊
	import doctorOrganize from '@/components/doctorOrganize/doctorOrganize.vue' //整理调度
	import doctorConsultation from '@/components/doctorConsultation/doctorConsultation.vue' //我的沟通
	import doctorPlusAdd from '@/components/doctorPlusAdd/doctorPlusAdd.vue' //加做医嘱
	import doctorExpress from '@/components/doctorExpress/doctorExpress.vue' //快递管理
	import doctorDetection from '@/components/doctorDetection/doctorDetection.vue' //项目检测
	import doctorTransfer from '@/components/doctorTransfer/doctorTransfer.vue' //待转资料
	export default {
		name: "pagesEntrance",
		components: {
			doctorOrganize,
			doctorHome,
			doctorConsultation,
			doctorPlusAdd,
			doctorExpress,
			doctorDetection,
			doctorTransfer,
			doctorApply
		},
		data() {
			return {
				contentheightData: 'calc(100vh - 368rpx)',
				permissionList: [],
				currentCode: '',
				currentIndex: 0,
				otherPermission: [{
					code: "interact",
					description: "我的沟通",
					dictionaryId: 9110,
					icon: "clone",
					id: 9110,
					name: "我的沟通",
					route: "/interact",
				}]
			};
		},
		created() {

		},
		mounted() {
			let permissionList = this.getpermissionList('院外会诊')
			this.getPermissionListArrEvent(permissionList.concat(this.otherPermission))

			// #ifdef H5
			// if (this.$wx.isWechat()) { // true  微信环境(有导航栏标题)  false  非微信环境(无导航栏标题)
			// 	this.contentheightData = 'calc(100vh - 658rpx)' //(131+118+80)*2  
			// } else {
			// 	this.contentheightData = 'calc(100vh - 746rpx)' //(131+118+80+44)*2 
			// }

			this.contentheightData = 'calc(100vh - 368rpx)'
			// #endif

		},
		// 上拉加载
		
		methods: {
			init(){
				console.log("返回加载--",this.currentCode)
				if(this.currentCode==="consultation-dispatch"){ //整理调度
					this.$refs.doctorOrganize.getmanagerElBadge()
				}else  if(this.currentCode==="consultation-diagnosis"){ //整理调度
					this.$refs.doctorHome.getElBadge()
				}else  if(this.currentCode==="interact"){ //整理调度
					this.$refs.doctorConsultation.search()
				}
			},
			getReachBottom(){
				console.log("上拉加载")
				if(this.currentCode==="extraProject"){ //加做医嘱
					this.$refs.doctorPlusAdd.scrolltolower()
				}else if(this.currentCode==="expressList"){ //快递管理
					this.$refs.doctorExpress.scrolltolower()
				}else if(this.currentCode==="detectionList"){ //项目检测
					this.$refs.doctorDetection.scrolltolower()
				}else if(this.currentCode==="transferInfo"){ //代转资料
					this.$refs.doctorTransfer.scrolltolower()
				}else if(this.currentCode==='askList'){//会诊申请
					this.$refs.askList.scrolltolower()
				}
			},
			getPermissionListArrEvent(data) {
				let dataArr = []
				data.forEach((item, index) => {
					if (item.route !== '/' && (item.code != 'platform-notification' && item.code !=
							'platform-overview')) {
						dataArr.push(item)
					}
				})
				if (dataArr && dataArr.length > 0) {
					this.permissionList = dataArr
					this.currentCode = dataArr[0].code
				}

			},
			changePageEntranceEvent(item) { // 切换工作台
				console.log('changePageEntranceEvent', item)
				this.currentIndex = item.index
				this.currentCode = item.code
			},
			getpermissionList(text) {
				let data = this.$store.state.user.permissionList
				console.log('getpermissionList-->>>>', data)
				let result = data.find(element => element.name === text);
				if (result) {
					
					
					return result.permissionList
				} else {
					return []
				}

			},
		}
	}
</script>

<style lang="scss" scoped>
	.sticky {
		position: sticky;
		// background: #000;
		z-index: 9;
		top: 0rpx;
	}

	.pagesEntrance {

		&_containers {

			&_top {
				background: linear-gradient(180deg, #5DDFFA 0%, #1E68E3 100%);
				// display: flex;
				// align-items: center;
				// flex-wrap: wrap;
				// &_item{
				// 	width:32%;
				// 	height:140rpx;
				// 	line-height: 140rpx;
				// 	color:#fff;
				// 	// font-weight:700;
				// 	font-size:32rpx;
				// 	margin:10rpx 0;
				// 	text-align: center;
				// 	background: linear-gradient( 180deg, #5DDFFA 0%, #1E68E3 100%);
				// 	box-shadow: 0px 4rpx 8rpx 0px rgba(66, 66, 157, 0.6);
				// }
				// &_item:nth-child(3n+2){
				// 	margin:10rpx 2%;
				// }
			}

			&_content {
				overflow: hidden;
				overflow-y: auto;
			}

		}

	}
</style>